/**
 * 全局字段 对应表或自定义 - for vue
 *
 * @author wenchuan.li
 * @date 2018/12/13 10:04
 */
define(function () {

    var fields = {}, nl = null;

    fields['sys_user'] = {
        ID: nl,
        ORG_ID: nl,
        ORG_NAME: nl,
        NAME: nl,
        ACCOUNT: nl,
        PASSWORD: nl,
        SEX: nl,
        EMAIL: nl,
        MOBILE: nl,
        IDNO: nl,
        TYPE: nl,
        STATUS: nl,
        ADDRESS: nl,
        REMARK: nl,
        SKIN: nl,
        BIZ_CODE: nl,
        DBC: nl,
        LANG: nl,
        ERP_DEPT: nl
    };

    fields['sys_role'] = {
        ID: nl, NAME: nl, IS_ENABLE: nl, TYPE: nl, BIZ_CODE: nl, REMARK: nl
    };

    fields['sys_user_role'] = {
        ID: nl, USER_ID: nl, ROLE_ID: nl
    };

    fields['sys_dic'] = {
        ID: nl,
        NAME: nl,
        DICKEY: nl,
        CODE: nl,
        DES: nl,
        IS_ENABLE: nl,
        HOTKEY: nl,
        TYPE: nl,
        SORT_NO: nl,
        REMARK: nl,
        NAME_EN: nl,
        NAME_TW: nl,
        GEN_TYPE: nl
    };

    fields['sys_module'] = {
        ID: nl,
        CASCADE_ID: nl,
        PARENT_ID: nl,
        NAME: nl,
        NAME_TW: nl,
        NAME_EN: nl,
        URL: nl,
        ICON_NAME: nl,
        IS_LEAF: nl,
        IS_AUTO_EXPAND: nl,
        IS_ENABLE: nl,
        VECTOR: nl,
        SORT_NO: nl,
        PERMISSION: nl,
        PARENT_NAME: nl
    };

    fields['sys_cmp'] = {
        ID: nl,
        NAME: nl,
        DOM_ID: nl,
        DOM_TYPE: nl,
        DOM_PERSSION: nl,
        RAMARK: nl,
        PAGE_ID: nl,
        MODULE_NAME: nl
    };

    fields['sys_org'] = {
        ID: nl,
        NAME: nl,
        PARENT_ID: nl,
        PARENT_NAME: nl,
        TYPE: nl,
        IS_AUTO_EXPAND: nl,
        BIZ_CODE: nl,
        SORT_NO: nl,
        RAMARK: nl
    };

    fields['sys_role'] = {
        ID: nl,
        NAME: nl,
        TYPE: nl,
        IS_ENABLE: nl,
        BIZ_CODE: nl,
        RAMARK: nl
    };

    fields['sys_params'] = {
        ID: nl,
        NAME: nl,
        CODE: nl,
        VALUE: nl,
        GROUP_: nl,
        RAMARK: nl
    };

    fields['sys_role_module'] = {
        ID: nl, ROLE_ID: nl, MODULE_ID: nl, GRANT_TYPE: nl
    };

    fields['sys_role_cmp'] = {
        ID: nl, ROLE_ID: nl, CMP_ID: nl, GRANT_TYPE: nl, CMP_STATUS: nl
    };

    fields['sys_customs'] = {
        ID: nl,
        CUSTOM_OBJ: nl,
        CUSTOM_OBJ_NAME_CN: nl,
        CUSTOM_OBJ_NAME_TW: nl,
        CUSTOM_OBJ_NAME_EN: nl,
        CUSTOM_REMARK: nl
    };

    fields['sys_user_device'] = {
        ID: nl, USER_ID: nl, DEVICE_ID: nl
    };

    fields['sys_task'] = {
        ID: nl, TASK_NAME: nl, TASK_CLASS: nl, TASK_RULE: nl, TASK_GROUP: nl, TASK_REMARK: nl,
        TASK001: nl, TASK002: nl, TASK003: nl, TASK004: nl, TASK005: nl
    };

    fields['sys_load'] = {
        ID: nl, LOAD_NAME: nl, LOAD_FILE: nl, LOAD_PARAMS: nl, LOAD_TRANDATE: nl
    };

    fields['gwdh'] = {
        GWDHENT: nl, GWDH001: nl, GWDH002: nl, GWDH004: nl, GWDH005: nl, GWDH006: nl, GWDH007: nl,
        GWDH008: nl, GWDHACTI: nl, GWDHDOCNO: nl
    };

    fields['gwdho'] = {
        GWDHOENT: nl, GWDHO001: nl, GWDHO002: nl, GWDHO003: nl, GWDHODOCNO: nl
    };

    fields['gwdhe'] = {
        GWDHEENT: nl, GWDHE001: nl, GWDHE002: nl, GWDHEDOCNO: nl
    };

    fields['sys_table_column'] = {
        TABLE_ID: nl, TABLE_NAME: nl, TABLE_REMARK: nl
    };

    fields['SYSMAIL']={
        ID:null, MAIL_SMTP:null, MAIL_PORT:null, MAIL_EMAIL:null, MAIL_PAW:null, MAIL_TYPE:null,
        MAILUD001:null,MAILUD002:null,MAILUD003:null,MAILUD004:null,MAILUD005:null,
    };


    // tags需要的对象(fields中的名称)String/Array(String)  vals初始化值的对象Json/Array(Json)
    app.fields_ = function (tags, vals) {
        var _temp = {};
        var _type = $.type(tags);
        if (_type == 'array') {
            tags.forEach(function (v) {
                $.extend(_temp, fields[v]);
            });
        } else if (_type == 'string') {
            $.extend(_temp, fields[tags]);
        }
        return app.extendUpLow({target: _temp, res: vals, replaceNull: true});
    };

    return fields;

});